package com.mhc.haval.manager.impl;

import com.mhc.haval.dal.mapper.ext.RoleFuncExtMapper;
import com.mhc.haval.dal.model.RoleFuncDO;
import com.mhc.haval.dal.query.RoleFuncQuery;
import com.mhc.haval.manager.RoleFuncManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * Manager for RoleFunc.
 */

@Service
public class RoleFuncManagerImpl implements RoleFuncManager{

    
    @Autowired
    protected RoleFuncExtMapper roleFuncExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(RoleFuncQuery query){
        return roleFuncExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(RoleFuncQuery query){
        return roleFuncExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(RoleFuncDO record){
        return roleFuncExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(RoleFuncDO record){
        return roleFuncExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<RoleFuncDO> selectByQuery(RoleFuncQuery query){
        return roleFuncExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<RoleFuncDO> selectByQueryWithPage(RoleFuncQuery query) {
        PageResult<RoleFuncDO> result = new PageResult<RoleFuncDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public RoleFuncDO selectByPrimaryKey(Long id){
        return roleFuncExtMapper.selectByPrimaryKey(id);
    }

    /**
     * select by role id.
     */
    @Override
    public List<RoleFuncDO> selectByRoleId(Long roleId){
        return roleFuncExtMapper.selectByRoleId(roleId);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( RoleFuncDO record,  RoleFuncQuery query){
        return roleFuncExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( RoleFuncDO record,  RoleFuncQuery query){

        return roleFuncExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(RoleFuncDO record){
        return roleFuncExtMapper.updateByPrimaryKeySelective(record);
    }
}